package com.zpark.controller;

import com.zpark.pojo.Account;
import com.zpark.service.IAccountService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.sql.SQLException;
import java.util.List;

/**
 * 账户控制层
 */
public class AccountController {

    public static void main(String[] args) throws SQLException {
        // 1、获取spring容器对象
        ApplicationContext app = new ClassPathXmlApplicationContext("beans.xml");
        // 2、根据id获取bean
        IAccountService accountService = app.getBean("accountService", IAccountService.class);
        // 3、使用bean
        List<Account> all = accountService.all();
        System.out.println(all);
    }

}
